package cate.game.admin.msg;

import cate.game.GameBody;
import cate.game.client.ClientContext;
import cate.game.client.msg.ClientMsg;
import cate.game.client.msg.MsgConfig;
import cate.game.client.msg.MsgInput;
import cate.game.client.msg.id.MsgIdBAdmin;
import easy.java.dev.note.NoteField;

import java.util.List;

@ClientMsg(title = "GM菜单执行の请求")
public class MenuRunReq implements MsgInput {
    @NoteField(value = "执行指令")
    public String cmd;

    @NoteField(value = "执行参数", detail = "字符串数组")
    public List<String> params;

    @Override
    public void execute(GameBody game, ClientContext cc) {
        if (!game.config.isAllowGm()) {
            game.notice.message(cc.getRole(), "打咩");
            return;
        }
        game.admin.runCmd(cc.getRole(), cmd, params);
    }

    @Override
    public MsgConfig conf() {
        return MsgIdBAdmin.MENU_RUN_REQ;
    }
}
